<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片预览工具</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', sans-serif;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
        }

        .container {
            background: white;
            padding: 30px;
            border-radius: 15px;
            box-shadow: 0 8px 20px rgba(0,0,0,0.1);
            width: 100%;
            max-width: 800px;
        }

        .header {
            text-align: center;
            margin-bottom: 30px;
        }

        .title {
            color: #2c3e50;
            font-size: 2.2em;
            margin-bottom: 10px;
        }

        .subtitle {
            color: #7f8c8d;
            font-size: 1.1em;
        }

        .input-group {
            display: flex;
            gap: 15px;
            margin-bottom: 30px;
        }

        #image-url {
            flex: 1;
            padding: 12px 20px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 1em;
            outline: none;
            transition: border-color 0.3s;
        }

        #image-url:focus {
            border-color: #3498db;
        }

        .btn {
            padding: 12px 30px;
            border: none;
            border-radius: 8px;
            background: #3498db;
            color: white;
            font-size: 1em;
            cursor: pointer;
            transition: transform 0.2s, background 0.3s;
        }

        .btn:hover {
            background: #2980b9;
        }

        .btn:active {
            transform: scale(0.95);
        }

        .image-preview {
            border-radius: 10px;
            max-width: 100%;
            height: auto;
            margin-top: 20px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.08);
            transition: opacity 0.3s;
            opacity: 0;
        }

        .image-preview.visible {
            opacity: 1;
        }
    </style>
</head>
<body>
        <div class="container">
                    <div class="header">
                                    <h1 class="title">大冶头像查询</h1>
                                                <p class="subtitle">输入大冶员工的工号</p>
                                                        </div>

                                                                <div class="input-group">
                                                                                <input type="text" id="image-url" placeholder="请输入员工的工号">
                                                                                            <button class="btn" onclick="loadImage()">查看</button>
                                                                                                    </div>

        <img src="" alt="图片预览" class="image-preview" id="preview-image">
    </div>

    <script>
        function loadImage() {
            const imgUrl = document.getElementById('image-url').value;
            const imgPreview = document.getElementById('preview-image');
            
            if (imgUrl.trim() === '') {
                alert('请输入有效的图片链接');
                return;
            }

            imgPreview.classList.remove('visible');
            imgPreview.src = imgUrl;
            
            imgPreview.onload = function() {
                imgPreview.classList.add('visible');
            };

            imgPreview.onerror = function() {
                imgPreview.classList.remove('visible');
                alert('无法加载该图片，请检查链接是否有效');
                imgPreview.src = '';
            };
        }
    </script>
</body>
</html>